Skip to content

DOCSP-41956: run a command #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 27, 2024

Conversation

rustagir
Copy link
Collaborator

@rustagir rustagir commented Sep 6, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-41956
Staging - https://deploy-preview-129--docs-php-library.netlify.app/run-command/

Self-Review Checklist

  • Is this free of any warnings or errors in the RST? orphan page
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

Copy link
Collaborator

@jordan-smith721 jordan-smith721 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! Just a few suggestions

Copy link
Collaborator

@jordan-smith721 jordan-smith721 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rustagir rustagir requested review from a team and GromNaN and removed request for a team September 6, 2024 17:25
@rustagir rustagir requested a review from GromNaN September 9, 2024 17:23
@rustagir
Copy link
Collaborator Author

rustagir commented Sep 23, 2024

Hi @GromNaN Please re-review this PR when you have a moment!

@rustagir rustagir requested a review from jmikola September 25, 2024 13:47
@rustagir rustagir force-pushed the DOCSP-41956-run-command branch from 14d08cb to bdc0a10 Compare September 25, 2024 19:13
Copy link

netlify bot commented Sep 25, 2024

Deploy Preview for docs-php-library ready!

Name Link
🔨 Latest commit 5053786
🔍 Latest deploy log https://app.netlify.com/sites/docs-php-library/deploys/66f5b2cc9a90ad0008852793
😎 Deploy Preview https://deploy-preview-129--docs-php-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rustagir rustagir force-pushed the DOCSP-41956-run-command branch from bdc0a10 to 160470c Compare September 25, 2024 19:14
@rustagir rustagir requested a review from jmikola September 25, 2024 19:22
If the number of documents in the command response is sufficiently large, you
can run a :manual:`getMore </reference/command/getMore/>` command to
retrieve the next batch of results from the cursor by using the cursor
ID.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this paragraph, as the driver handles this on its own. When you iterate the cursor beyond a batch, the driver will issue a getMore to pull in the next batch for continued iteration. When the cursor ID comes back as zero, the driver knows not to issue further getMore commands and prohibits further iteration beyond whatever remains in the last batch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - this applies only for the shell method I guess? Misunderstood a comment you made in the previous review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior in PHPLIB's Database::command() (and PHPC's executeCommand()) method is probably unique. Other drivers may have a separate method for the envelope handling (see: runCursorCommand in the driver spec).

AFAIK, db.runCommand() returns the raw response with no envelope unpacking, and I don't think the shell has a command cursor variant. I'm also not aware of any way in the shell to construct a cursor object from a raw response, so a script written for mongosh would probably need to manually execute getMore commands.


But more generally, if you have a cursor object in the driver or shell, you can trust that it will use getMore as needed to continue iteration. And db.runCommand() does not give you a cursor.

@rustagir rustagir force-pushed the DOCSP-41956-run-command branch from b584444 to 8918fbf Compare September 26, 2024 19:06
@rustagir rustagir requested a review from jmikola September 26, 2024 19:12
@rustagir rustagir merged commit f4834bf into mongodb:php-standardization Sep 27, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants